package com.ipay.wechat.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ipay.wechat.dao.PayChannelDao;
import com.ipay.wechat.pojo.PayChannelEntity;
import com.ipay.wechat.service.PayChannelService;



@Service("payChannelService")
public class PayChannelServiceImpl implements PayChannelService {
	@Autowired
	private PayChannelDao payChannelDao;

	@Override
	public PayChannelEntity queryObject(Long id) {
		return payChannelDao.queryObject(id);
	}

	@Override
	public List<PayChannelEntity> queryList(Map<String, Object> map) {
		return payChannelDao.queryList(map);
	}

	@Override
	public int queryTotal(Map<String, Object> map) {
		return payChannelDao.queryTotal(map);
	}

	@Override
	public void save(PayChannelEntity payChannel) {
		payChannelDao.save(payChannel);
	}

	@Override
	public int update(PayChannelEntity payChannel) {
		return payChannelDao.update(payChannel);
		
	}

	@Override
	public int deleteBatch(Long[] ids) {
		return payChannelDao.deleteBatch(ids);
	}
	
	@Override
	public PayChannelEntity queryPayBymerchantNo(Map<String, Object> map){
		List<PayChannelEntity> payChannelList = payChannelDao.queryPayBymerchantNo(map);
		if(payChannelList!=null&&payChannelList.size()==1){
			System.out.println("支付渠道参数条数："+payChannelList.size());
			return payChannelList.get(0);
		}
		return new PayChannelEntity();
	}
}
